import { reqGoodsDetail } from '@/api/index'

let state = {
  goodsDetail: {
    categoryView: {},
    spuSaleAttrList: [],
    skuInfo: {}
  }
}

let mutations = {
  GETGOODSDETAIL(state, data) {
    state.goodsDetail = data
  }
}

let actions = {
  // 获取商品信息
  async getGoodsDetail({ commit }, id) {
    let result = await reqGoodsDetail(id)
    if (result.code == 200) {
      commit('GETGOODSDETAIL', result.data)
    }
  }
}

let getters = {}

export default {
  state,
  mutations,
  actions,
  getters
}
